package com.twu.biblioteca;

import java.io.PrintStream;
import java.util.HashMap;

/**
 * Created with IntelliJ IDEA.
 * User: Thoughtworker
 * Date: 8/27/13
 * Time: 2:12 PM
 * To change this template use File | Settings | File Templates.
 */
public class UserLibrary {

    HashMap<String, User> users;
    PrintStream printStream;

    public UserLibrary(HashMap<String, User> users, PrintStream printStream) {
        this.users = users;
        this.printStream = printStream;
    }


    public void verifyUser(String userName, String Password) {
        if( users.containsKey(userName)){
            if(users.get(userName).getPassword().equals(Password)){
                printStream.println("You are logged in");
            }else{
                printStream.println("Incorrect Password \n Please talk to a Librarian. \nThank you.");
               // printStream.printf("Given pwd: %s , Actual pwd: %s ", Password,users.get(Password).getPassword());
            }
        }else{
            printStream.println("Incorrect Username \n Please talk to a Librarian. \nThank you.");
        }

    }
}
